package com.mmy.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.HandlerInterceptor;

public class AllInterceptor implements HandlerInterceptor {
	Logger logger = LoggerFactory.getLogger(AllInterceptor.class);
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		String path = request.getServletPath();
		logger.info(path);
		if (path.contains("back")& null == request.getSession().getAttribute("tSysUser")) {
			response.sendRedirect("/mmy");
			return false;
		}
		return true;
	}
}
